 class FactorialSum {

    public static void main(String[] args) {
        double sum = 0; // 使用double类型来存储总和

        for (int i = 1; i <= 100; i++) {
            sum += factorial(i); // 将每个阶乘加到总和中
        }

        System.out.println("1! + 2! + 3! + ... + 100! = " + sum);
    }

    // 计算n的阶乘
    public static double factorial(int n) {
        double result = 1;
        for (int i = 1; i <= n; i++) {
            result *= i;
        }
        return result;
    }
}